package com.yeyks.app.controller.base.activity;

import com.yeyks.activity.dal.domain.ActivityDrawRecordNew;
import com.yeyks.activity.dal.domain.ActivityList;
import com.yeyks.app.annotation.LoadUserId;
import com.yeyks.common.ajax.AjaxResponseBody;
import com.yeyks.common.param.PageParam;
import com.yeyks.common.param.consumer.UserIdParam;
import com.yeyks.commonReference.append.activity.ActivityDoubleDanService;
import com.yeyks.commonReference.pojo.param.activity.DoubleDan.*;
import com.yeyks.commonReference.pojo.vo.activity.DoubleDan.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

//@Api(tags = "双旦活动v3.8", description = "双旦活动")
//@Controller
//@RequestMapping(value = "/app/activity/doubleDan", method = RequestMethod.POST)
public class ActivityDoubleDanController {

    @Autowired
    private ActivityDoubleDanService activityDoubleDanService;

    @ApiOperation(value = "活动详情v3.8", notes = "活动详情")
    @PostMapping("/activity/detail")
    @ResponseBody
    public AjaxResponseBody<ActivityList> getActivityDetail() {
        return AjaxResponseBody.success(activityDoubleDanService.getActivityDetail());
    }

    @ApiOperation(value = "统计v3.8", notes = "统计")
    @PostMapping("/statistic/increment")
    @ResponseBody
    public AjaxResponseBody<Boolean> statisticIncrement(@Validated ActivityDoubleDanStatisticIncrementParam param) {
        return AjaxResponseBody.success(activityDoubleDanService.statisticIncrement(param));
    }

    /*
    活动转发人数客户端
    活动转发人数小程序
     */
    @ApiOperation(value = "活动转发人数记录v3.8", notes = "")
    @PostMapping("/statistic/increment/activityForwardNumberRecord")
    @ResponseBody
    public AjaxResponseBody statisticIncrementActivityForwardNumberRecord(@LoadUserId @Validated ActivityDoubleDanStatisticIncrementActivityForwardNumberRecordParam param) {
        activityDoubleDanService.statisticIncrementActivityForwardNumberRecord(param);
        return AjaxResponseBody.success();
    }

    @ApiOperation(value = "轮播v3.8", notes = "")
    @PostMapping("/getCarousel")
    @ResponseBody
    public AjaxResponseBody<List<ActivityDoubleDanGetCarouselVo>> getCarousel(PageParam param) {
        return AjaxResponseBody.success(activityDoubleDanService.getCarousel(param));
    }

    @ApiOperation(value = "获取宝箱状况v3.8", notes = "")
    @PostMapping("/getTreasureChestStatus")
    @ResponseBody
    public AjaxResponseBody<ActivityDoubleDanTreasureChestStatusVo> getTreasureChestStatus(@LoadUserId ActivityDoubleDanTreasureChestStatusParam param) {
        return AjaxResponseBody.success(activityDoubleDanService.getTreasureChestStatus(param));
    }

    @ApiOperation(value = "宝箱抽奖v3.8", notes = "")
    @PostMapping("/lotteryTreasureChest")
    @ResponseBody
    public AjaxResponseBody<ActivityDoubleDanlotteryTreasureChestVo> lotteryTreasureChest(@LoadUserId ActivityDoubleDanlotteryTreasureChestParam param) {
        return AjaxResponseBody.success(activityDoubleDanService.lotteryTreasureChest(param));
    }

    @ApiOperation(value = "获取抽奖列表v3.8", notes = "")
    @PostMapping("/getPrizeList")
    @ResponseBody
    public AjaxResponseBody<ActivityDoubleDanGetPrizeListVo> getPrizeList() {
        return AjaxResponseBody.success(activityDoubleDanService.getPrizeList());
    }

    @ApiOperation(value = "获取抽奖次数v3.8", notes = "")
    @PostMapping("/getPrizeCount")
    @ResponseBody
    public AjaxResponseBody<ActivityDoubleDanGetPrizeCountVo> getPrizeCount(@LoadUserId UserIdParam param) {
        return AjaxResponseBody.success(activityDoubleDanService.getPrizeCount(param));
    }

    @ApiOperation(value = "抽奖v3.8", notes = "")
    @RequestMapping("/lottery")
    @ResponseBody
    public AjaxResponseBody<ActivityDoubleDanLotteryVo> lottery(@LoadUserId ActivityDoubleDanLotteryParam param) {
        return AjaxResponseBody.success(activityDoubleDanService.lottery(param));
    }

    @ApiOperation(value = "增加分享抽奖次数v3.8", notes = "")
    @RequestMapping("/inrLotteryCount")
    @ResponseBody
    public AjaxResponseBody<Boolean> inrLotteryCount(@LoadUserId ActivityDoubleDanInrLotteryCountParam param) {
        return AjaxResponseBody.success(activityDoubleDanService.inrLotteryCount(param.getUserId(), 1));
    }

    @ApiOperation(value = "获取获奖明细v3.8", notes = "")
    @RequestMapping("/getAwardDetails")
    @ResponseBody
    public AjaxResponseBody<List<ActivityDrawRecordNew>> getAwardDetails(@LoadUserId ActivityDoubleDanAwardDetailsParam param) {
        return AjaxResponseBody.success(activityDoubleDanService.getAwardDetails(param.getUserId()));
    }

}
